﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Unicode;
using XF.FM.Core.Options;

namespace XF.FM
{
    public class XfConfig
    {
        public static XfOptionConfig DefaultXfOptionConfig = new XfOptionConfig() { FileDir = "xfconfig", FileEncoding = Encoding.UTF8 };
        public static JsonSerializerOptions DefaultJsonSerializerOptions = new JsonSerializerOptions()
        {
            WriteIndented = true,
            Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(UnicodeRanges.All)
        };
        public XfConfig()
        {
            //添加GBK支持
            //Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
        }
        public IDictionary<string, IXfOption> XfOptions = new Dictionary<string, IXfOption>();
        /// <summary>
        /// 添加IXfOption，key为xfOption的Key
        /// </summary>
        /// <param name="xfOption"></param>
        public void AddOption(IXfOption xfOption)
        {
            XfOptions.Add(xfOption.Key, xfOption);
        }
    }
}
